import { defineComponent } from 'vue'
import { provide, reactive } from 'vue'
import componentsConfig from '@/components/components.json'
import Editor from '@/packages/editor'
import registerConfig from '@/utils/editor-config'
import useRegisterConfigStore from '@/store/registerConfigStore'

export default defineComponent({
  setup() {
    provide('registerConfig', registerConfig)

    const registerConfigStore = useRegisterConfigStore()
    registerConfigStore.registerConfig = registerConfig

    let data = reactive(componentsConfig)

    let userInfo = reactive({})

    return () => (
      <div>
        <Editor v-model={data} formData={userInfo}></Editor>
      </div>
    )
  },
})
